<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>积分兑换</title>
    <script src="/static/mui/js/mui.min.js"></script>
	<script src="/static/js/jquery-2.1.1.js"></script>
    <link href="/static/mui/css/mui.min.css" rel="stylesheet"/>
	<link href="/static/mui/css/style.css" rel="stylesheet"/>
    <script type="text/javascript" charset="utf-8">
      	mui.init();
    </script>
</head>
<body>
	 <div class="main">
		 <div class="mui-slider">
		   <div class="mui-slider-group">
			   {volist name="$exchange['images']" id="vo"}
			   		<div class="mui-slider-item"><img src="{$vo}" /></div>
			   {/volist}
		   </div>
		 </div>
		 <div class="title">
		 	<span>用户基本信息</span>
		 </div>
		 <div class="sub_title">
			 <div>粉丝昵称:{$detail.nickname}</div>
			 <div>名称:{$detail.name}</div>
			 <div>所属身份:{$detail.type}</div>
			 <div>联系电话:{$detail.mobile}</div>
		 </div>
		 
		 <div class="title">
		 	<span>产品信息</span>
		 </div>
		 <div class="pro_title">
			 <div>兑换产品:{$detail.title}</div>
			 <div>消费积分:{$detail.integral}</div>
			 <div>核销码:{$detail.order_sn}</div>
			 <div>当前状态:<font style="color: red">{$detail.status}</font></div>
			 <div>兑换时间:{$detail.addtime|date="Y-m-d H:i:s",###}</div>
		 </div>
		 <div class="title">
			 <span>详细介绍</span>
		 </div>
		 <div class="contetn">
			{$exchange.content}
		 </div>
		 <div class="zxd_button">
		 		 <button class="success" data-val="2">核销</button>
		 		 <button class="success" data-val="3">驳回</button>
		 </div>
	 </div>

	 <input type="hidden" class="mui-input-clear id" value="{$detail.id}">
	 <input type="hidden" class="mui-input-clear colony_id" value="{$detail.colony_id}">
	 <input type="hidden" class="mui-input-clear uniacid" value="{$exchange.uniacid}">

	<div class="verification" data-val="{$manager}" >
		<div class="content">

			<h4>请输入核销人员的账号</h4>
			<div class="mui-input-row">
				<label>账号</label>
				<input type="text" class="mui-input-clear name" placeholder="请输入用户名">
			</div>
			<div class="mui-input-row">
				<label>密码</label>
				<input type="password" class="mui-input-password password" placeholder="请输入密码">
			</div>
			<div class="mui-button-row">
				<button type="button" class="mui-btn mui-btn-primary sure" >确认</button>
				<button type="button" class="mui-btn mui-btn-danger quit" >取消</button>
			</div>
		</div>
	</div>
	 
<script>
	$(".success").click(function(){
		var val = $(".verification").attr("data-val")
		if(val==0){
			$(".verification").fadeIn("5000");
		}else{
			var status = $(this).attr("data-val");
			var id = $(".id").val();

			$.ajax({
				url: "{:URL('web/Exchange/updateStatus')}",
				type: 'POST',
				data: {status:status,id:id},
				dataType: 'json',
				success:function (res) {
					mui.toast(res.msg);
				}
				,error:function (res) {
					mui.alert('错误');
				}
			});
		}
	});
	$(".quit").click(function(){
		$(".verification").fadeOut();
	})
	$(".sure").click(function(){
		var colony_id = $(".colony_id").val();
		var uniacid = $(".uniacid").val();
		var name = $(".name").val();
		var password = $(".password").val();
		if(name==''){
			mui.alert("请输入账号");return;
		}
		if(password==''){
			mui.alert("请输入密码");return;
		}

		$.ajax({
			url: "{:URL('web/Exchange/dologin')}",
			type: 'POST',
			data: {colony_id:colony_id,uniacid:uniacid,name:name,password:password},
			dataType: 'json',
			success:function (res) {
				mui.toast(res.msg);
				if(res.code==0){
					$(".verification").attr("data-val",res.manager);
					$(".verification").fadeOut();
				}
			}
			,error:function (res) {
				mui.alert('错误');
			}
		});


	})
</script>
</body>
</html>